<?php
namespace app\model;

class Area extends Common
{
    protected static $obj;

    public function _initialize()
    {
        parent::_initialize();
        $this->db_name = 'area';
    }

    /**
     * 类入口
     * @return Area
     */
    public static function getInstance()
    {
        if (is_null(self::$obj))
            self::$obj = new self();
        return self::$obj;
    }

    /**
     * 获取地址名
     * @param $int_area_id int 地址id
     * @param int $int_parent_id int 上级地址id
     * @return string
     */
    public function getAreaName($int_area_id, $int_parent_id)
    {
        return (string)$this->toValue(['id' => $int_area_id, 'parent_id' => $int_parent_id], 'name');
    }
}
